﻿using System;
using System.Collections.Generic;
using System.Data.SqlServerCe;
using System.Linq;
using System.Text;

namespace KBS8.Data.GdfDataFilter
{
    class DatabaseHandler : OutputHandler
    {
        private readonly DatabaseReader[] _databaseReaders;

        public DatabaseHandler()
        {
            SqlCeConnection connection = new SqlCeConnection(@"Data Source=|DataDirectory|\KSB8.sdf");
            _databaseReaders = new DatabaseReader[]{new AreaFeatureReader(connection), new ComplexFeatureReader(connection), new LineFeatureReader(connection), new PointFeatureReader(connection) };
        }

        /// <summary>
        /// The mehtod performs the action of the handler
        /// </summary>
        public override void Handle()
        {
            foreach (DatabaseReader databaseReader in _databaseReaders)
            {
                databaseReader.Read(Output);
            }
            base.Handle();
        }
    }
}
